package com.obas.utils {

   import flash.events.Event;
   import flash.events.EventDispatcher;

   public class AppContextData extends EventDispatcher {

      public function AppContextData(singletonToken:SingletonToken) {
      }

      private static var _instance:AppContextData = null;
      public static function getInstance():AppContextData {
         if(_instance == null) {
            _instance = new AppContextData(new SingletonToken());
         }
         return _instance;
      }

      private var _currentUserId:Number = NaN;

      public function get currentUserId():Number {
         return _currentUserId;
      }

      public function set currentUserId(value:Number):void {
         _currentUserId = value;
      }

      private var _currentUserName:String = "";
      [Bindable]
      public function get currentUserName():String {
         return _currentUserName;
      }

      public function set currentUserName(value:String):void {
         _currentUserName = value;
      }

	  private var _username:String = "";
	  [Bindable]
	  public function get username():String {
		  return _username;
	  }

	  public function set username(value:String):void {
		  _username = value;
	  }

      private var _systemName:String = null;

      [Bindable("systemNameChanged")]
      public function get systemName():String {
         return _systemName;
      }

      public function set systemName(value:String):void {
         if (_systemName == value) {
            return;
         }

         _systemName = value;
         dispatchEvent(new Event("systemNameChanged"));
      }

      private var _systemTitle:String = null;

      [Bindable("systemTitleChanged")]
      public function get systemTitle():String {
         return _systemTitle;
      }

      public function set systemTitle(value:String):void {
         if (_systemTitle == value) {
            return;
         }

         _systemTitle = value;
         dispatchEvent(new Event("systemTitleChanged"));
      }

      private var _sessionTimeout:Number = 0;
      [Bindable("sessionTimeoutChanged")]
      public function get sessionTimeout():Number {
         return _sessionTimeout;
      }

      public function set sessionTimeout(value:Number):void {
         if (_sessionTimeout == value) {
            return;
         }

         _sessionTimeout = value;
         dispatchEvent(new Event("sessionTimeoutChanged"));
      }

      private var _screenLocked:Boolean = false;

      [Bindable("screenLockedChanged")]
      public function get screenLocked():Boolean {
         return _screenLocked;
      }

      public function set screenLocked(value:Boolean):void {
         if (_screenLocked == value) {
            return;
         }

         _screenLocked = value;
         dispatchEvent(new Event("screenLockedChanged"));
      }

      private var _systemVersion:String;
      [Bindable]
      public function get systemVersion():String {
         return _systemVersion;
      }

      public function set systemVersion(value:String):void {
         _systemVersion = value;
      }

   }
}

class SingletonToken {}